package com.z.pms1.action;

import org.springframework.beans.factory.annotation.Autowired;

import com.z.pms1.service.MenuService;
import com.z.pms1.vo.AckJsonVo;
import com.z.pms1.vo.MenuVo;

/**
 * @Title: 
 * @Description:Handle menu requests
 * @Copyright: z 2013
 * @Date: Jan 28, 2013 4:45:13 PM
 * @author: caizhen
 * @version: 1.0
 */
public class MenuAction extends BaseAction {
	
	@Autowired
	private MenuService menuService;
	
//	private String menuStr = 
//			"[{\"pid\":null,\"pname\":null,\"attributes\":{\"url\":\"\"},\"id\":\"0\",\"text\":\"Menu\",\"url\":\"\",\"iconCls\":\"icon-tip\",\"seq\":1}," +
//			"{\"pid\":\"0\",\"pname\":null,\"attributes\":{\"url\":\"\"},\"id\":\"xtgl\",\"text\":\"System Management\",\"url\":\"\",\"iconCls\":\"icon-sum\",\"seq\":1}," +
//			"{\"pid\":\"xtgl\",\"pname\":null,\"attributes\":{\"url\":\"/admin/yhgl.jsp\"},\"id\":\"yhgl\",\"text\":\"User Management\",\"url\":\"/admin/yhgl.jsp\",\"iconCls\":\"icon-back\",\"seq\":1}," +
//			"{\"pid\":\"xtgl\",\"pname\":null,\"attributes\":{\"url\":\"/admin/jsgl.jsp\"},\"id\":\"jsgl\",\"text\":\"Role Management\",\"url\":\"/admin/jsgl.jsp\",\"iconCls\":null,\"seq\":2}," +
//			"{\"pid\":\"xtgl\",\"pname\":null,\"attributes\":{\"url\":\"/admin/zygl.jsp\"},\"id\":\"zygl\",\"text\":\"Resource Management\",\"url\":\"/admin/zygl.jsp\",\"iconCls\":null,\"seq\":3}," +
//			"{\"pid\":\"xtgl\",\"pname\":null,\"attributes\":{\"url\":\"/menu/query.jsp\"},\"id\":\"MenuManagement\",\"text\":\"Menu Management\",\"url\":\"/menu/query.jsp\",\"iconCls\":null,\"seq\":4}," +
//			"{\"pid\":\"xtgl\",\"pname\":null,\"attributes\":{\"url\":\"/admin/buggl.jsp\"},\"id\":\"buggl\",\"text\":\"Bug Management\",\"url\":\"/admin/buggl.jsp\",\"iconCls\":null,\"seq\":5}," +
//			"{\"pid\":\"0\",\"pname\":null,\"attributes\":{\"url\":\"\"},\"id\":\"Slumber Management\",\"text\":\"Slumber Management\",\"url\":\"\",\"iconCls\":null,\"seq\":2}," +
//			"{\"pid\":\"Slumber Management\",\"pname\":null,\"attributes\":{\"url\":\"/slumber/query.jsp\"},\"id\":\"SlumberMonitor\",\"text\":\"Slumber Monitor\",\"url\":\"/slumber/query.jsp\",\"iconCls\":\"icon-tip\",\"seq\":1}]"
//			;
	
	public void loadMenu() {
		//printToJson(menuStr);
		printToJson(menuService.allTreeNode());
	}
	
	public void query() {
		printToJson(menuService.treegrid());
	}
	
	public void edit() {
//		MenuVo menuVo = menuService.edit(menuVo);
//		AckJsonVo ack = new AckJsonVo();
//		ack.setSuccess(true);
//		ack.setObj(menuVo);
//		ack.setMsg("Edit Success!");
//		printToJson(ack);
	}
	
}
